package ae.pcfc.etks.online.common.dao.provider;


//TODO: NOT REQUIRED!!!!

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import ae.pcfc.etks.online.common.dao.NewNonClientCompanyRoleDAO;
import ae.pcfc.etks.online.common.domain.ClientServiceRoleReq;

@Repository
public class NewNonClientCompanyRoleDAOImpl extends BaseDAO implements NewNonClientCompanyRoleDAO{
	
/**
 * getNewClientRoleByClientId
 * 
 * @see ae.pcfc.etks.online.common.dao.NewNonClientCompanyRoleDAO#getNewClientRoleByClientId(java.lang.Long, java.lang.String)
 * 
 */
public ClientServiceRoleReq getNewClientRoleByClientId(Long clientId,String clientType){
		
		Criteria criteria = getHibernateTemplate().getSessionFactory().getCurrentSession().createCriteria(ClientServiceRoleReq.class);
		if(clientId != null)
		criteria.add(Restrictions.eq("csReqRoleId", clientId));
		List<ClientServiceRoleReq> list =  criteria.list();		
		if(list.size() > 0)
			return list.get(0);
		else
			return null;
	}
}


